<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>红包活动列表</title>
<link href="/electriccar/Public/admin/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/electriccar/Public/admin/js/jquery.js"></script>

<link href="/electriccar/Public/admin/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/electriccar/Public/admin/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="/electriccar/Public/admin/js/select-ui.min.js"></script>

<script type="text/javascript" src="/electriccar/Public/layer/layer.js"></script>

<script type="text/javascript">
$(document).ready(function(e) {
    $("#red_type").uedSelect({
		width : 150			  
	});
});

//弹出营销型红包详情
function showbonus(red_id,title){
	layer.open({
		type: 2,
		title: title,
		maxmin: false,
		shadeClose: true, //点击遮罩关闭层
		area : ['800px' , '520px'],
		content: '<?php echo U("redpacketmoney/showbonus");?>&red_id='+red_id
	});
}
</script>
</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="<?php echo U('index/welcome');?>">首页</a></li>
			<li><a href="<?php echo U('redpacketmoney/index');?>">红包活动列表（金额）</a></li>
		</ul>
    </div>
    
    <div class="formbody">
		<ul class="toolbar">
			<li onclick="location.href = '<?php echo U('redpacketmoney/addredpacket');?>'"><span><img src="/electriccar/Public/admin/images/t01.png" /></span>添加红包活动</li> 
		</ul> 
		<form name="seachform" id="seachform" action="<?php echo U('redpacketmoney/index');?>" method="post">
			<ul class="seachform">
				<li><label>综合查询</label><input name="info[keyword]" id="keyword" value="<?php echo ($keyword); ?>" type="text" class="scinput" /></li>
				<li><label>活动类型</label>
					<div class="vocation">
						<select id="red_type" name="info[red_type]">
							<option value="">请选择类型</option>
							<?php if(is_array($redtype)): $i = 0; $__LIST__ = $redtype;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($key == $red_type ): ?>selected<?php endif; ?>><?php echo ($data); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
				</li>
				<li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
			</ul>
		</form>
		
		<table class="tablelist">
			<thead>
				<tr>
					<th><input name="" type="checkbox" value="" /></th>
					<th>编号</th>
					<th>红包活动名称</th>
					<th>红包分类</th>
					<th>小包金额范围</th>
					<th>时间范围</th>
					<th>添加时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(is_array($listinfo)): $i = 0; $__LIST__ = $listinfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$red): $mod = ($i % 2 );++$i;?><tr>
					<td><input name="" type="checkbox" value="" /></td>
					<td><?php echo ($red["red_id"]); ?></td>
					<td><?php echo ($red["red_title"]); ?></td>
					<td><?php echo ($redtype[$red['red_type']]); ?></td>
					<td><?php echo ($red["red_min"]); ?>-<?php echo ($red["red_max"]); ?></td>
					<td><?php echo (date("Y-m-d H:i:s",$red["red_starttime"])); ?>至<?php echo (date("Y-m-d H:i:s",$red["red_endtime"])); ?></td>
					<td><?php echo (date("Y-m-d H:i:s",$red["red_addtime"])); ?></td>
					<td>
						<?php if($red["red_type"] == 3): ?><!--营销型红包未开始可以编辑，开始后不可以编辑-->
							<?php if($red["red_starttime"] > SYS_TIME): ?><a href="<?php echo U('redpacketmoney/editredpacket',array('red_id'=>$red['red_id']));?>" class="tablelink" onclick="{if(confirm('确认编辑? 营销型红包在执行时间范围内请不要编辑，负责会导致数据不统一问题！')){return true;}return false;}">编辑</a><?php endif; ?>
						<?php else: ?>
							<a href="<?php echo U('redpacketmoney/editredpacket',array('red_id'=>$red['red_id']));?>" class="tablelink" onclick="{if(confirm('确认编辑?')){return true;}return false;}">编辑</a><?php endif; ?>
						<?php if($red["red_type"] == 3): ?><!--营销型红包查看红包详情-->
							<a href="javascript:showbonus(<?php echo ($red["red_id"]); ?>,'<?php echo ($red["red_title"]); ?>');" class="tablelink">查看</a><?php endif; ?>
						<a href="<?php echo U('redpacketmoney/delredpacket',array('red_id'=>$red['red_id']));?>" onclick="{if(confirm('确认删除?')){return true;}return false;}" class="tablelink">删除</a>
					</td>
				</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			</tbody>
		</table>

		<?php echo ($pageshow); ?>

    </div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>

</html>